package cn.yunhe.action;

import cn.yunhe.pojo.Street;
import cn.yunhe.service.StreetService;
import cn.yunhe.util.BaseAction;
import com.opensymphony.xwork2.ModelDriven;

import java.util.ArrayList;
import java.util.List;

public class StreetAction extends BaseAction implements ModelDriven {
    private Street street;
    private String target;
    private List<Street> streetList=new ArrayList<>();

    StreetService streetService=new StreetService();
    public String streetList(){
        Street street1=new Street();
        //此处使用sid接收了关于did的值,目的:使用模型驱动
        /*System.out.println("street.getSid()=============="+street.getSid());*/
        street1.getDistrict().setDid(street.getSid());
        streetList=streetService.streetList(street1);
        return SUCCESS;
    }


    public Street getStreet() {
        return street;
    }

    public void setStreet(Street street) {
        this.street = street;
    }
    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public List<Street> getStreetList() {
        return streetList;
    }

    public void setStreetList(List<Street> streetList) {
        this.streetList = streetList;
    }

    @Override
    public Street getModel() {
        if (street==null)
            street=new Street();
        return street;
    }
}
